<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
<div class="timo-detail-page">
    <div class="timo-detail-title">获取上线资料</div>
    <input type="hidden" id="versionId" th:value="${versionId}">
    <table class="layui-table timo-detail-table">
        <colgroup>
            <col width="100px"><col>
            <col width="100px"><col>
        </colgroup>
        <tbody>
        <tr>
            <th>选择环境</th>
            <td>
                <select class="timo-search-select layui-input" id="combinePubEnv" mo:dict="ENV_NAMES"></select>
            </td>
            <th>选择资料</th>
            <td>
                <select class="timo-search-select layui-input" id="combinePubProfile" mo:dict="PUBLISH_PROFILES"></select>
            </td>
            <td>
                <button class="layui-btn" style="margin-left: 2em;" id="combinePubBtn">提取</button>
            </td>
        </tr>
        <tr>
            <th>汇总的内容</th>
            <td colspan="4">
                <textarea id="profileContent" rows="30" cols="120" readonly="readonly"></textarea>
            </td>
        </tr>
        </tbody>
    </table>
    <button class="layui-btn" onclick="javascript:history.back();"><i class="fa fa-check-circle"></i> 返回</button>
</div>
<script th:replace="/common/template :: script"></script>
<script>
layui.use(['element', 'form', 'layer', 'upload'], function () {
    var $ = layui.jquery;
    $(document).ready(function () {
        $('#combinePubBtn').click(function () {
            $.post('/app/version/branch/combinepub'
                ,{'versionId': $('#versionId').val(),'combinePubEnv':$('#combinePubEnv').val(),'combinePubProfile':$('#combinePubProfile').val()}
                ,function (res) {
                    if (res) {
                        if (res.code==200) {
                            $('#profileContent').val(res.data);
                        }else{
                            layer.alert(res.msg, {area: ['600px', '400px'],offset: '15px', icon: 1,btn:['知道了']},function (index) {
                                layer.close(index);
                            });
                        }
                    }
            });
        });
        $('#combinePubBtn').click();
    });
});
</script>
</body>
</html>